package com.ug.system.controller;

import com.ug.common.constant.SecurityConstants;
import com.ug.common.response.ResponseMessage;
import com.ug.common.response.ResponseMessageFactory;
import com.ug.system.entity.vo.TableInfoVO;
import com.ug.system.service.ShowTablesService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: LY
 * @date: 2024/12/30 11:15
 * @description: 数据库表信息
 */
@Tag(name = "ShowTablesController", description = "数据库信息")
@RestController
@RequiredArgsConstructor
@RequestMapping("/tables")
public class ShowTablesController {

    private final ShowTablesService showTablesService;

    @Operation(summary = "表结构信息", security = { @SecurityRequirement(name = SecurityConstants.TOKEN_HEADER) })
    @GetMapping("/tableInfolist")
    public ResponseMessage<List<TableInfoVO>> getAllTableInfoList(){
        return ResponseMessageFactory.getSuccessResponseMessage(showTablesService.getAllTableInfoList());
    }
}
